package com.lanyou.esb.redis.vo;

import java.util.Date;

import javax.xml.bind.annotation.XmlElement;

import org.apache.commons.lang3.StringUtils;

import com.fasterxml.jackson.annotation.JsonIgnore;
import com.lanyou.cook.entity.domain.FieldSystem;
import com.lanyou.esb.datadictionary.EnableType;

/**
 * 领域系统表
 * 
 * @author Davey.wu
 */
public class FieldSystemVo {
	/** 领域系统表ID **/
	private String id;

	/** 领域信息表ID **/
	private String fieldId;

	/** 系统编码 **/
	private String code;

	/** 系统名称 **/
	private String name;

	/** 备注 **/
	private String remark;

	/** KETTLE目录表主键 **/
	private int directoryId;

	/** 是否可用 **/
	private boolean isEnable;

	/** 创建人 **/
	private String creator;

	/** 创建时间 **/
	private Date createdDate;

	/** 最后更新人员 **/
	private String modifier;

	/** 最后更新时间 **/
	private Date lastUpdatedDate;

	/** 并发控制字段 **/
	private int version;

	public String getCode() {
		return code;
	}

	public void setCode(String code) {
		this.code = code;
	}

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public String getId() {
		return id;
	}

	public void setId(String id) {
		this.id = id;
	}

	public String getFieldId() {
		return fieldId;
	}

	public void setFieldId(String fieldId) {
		this.fieldId = fieldId;
	}

	public String getRemark() {
		return remark;
	}

	public void setRemark(String remark) {
		this.remark = remark;
	}

	public int getDirectoryId() {
		return directoryId;
	}

	public void setDirectoryId(int directoryId) {
		this.directoryId = directoryId;
	}


	public boolean isEnable() {
		return isEnable;
	}

	public void setEnable(boolean isEnable) {
		this.isEnable = isEnable;
	}

	public String getCreator() {
		return creator;
	}

	public void setCreator(String creator) {
		this.creator = creator;
	}

	public Date getCreatedDate() {
		return createdDate;
	}

	public void setCreatedDate(Date createdDate) {
		this.createdDate = createdDate;
	}

	public String getModifier() {
		return modifier;
	}

	public void setModifier(String modifier) {
		this.modifier = modifier;
	}

	public Date getLastUpdatedDate() {
		return lastUpdatedDate;
	}

	public void setLastUpdatedDate(Date lastUpdatedDate) {
		this.lastUpdatedDate = lastUpdatedDate;
	}

	public int getVersion() {
		return version;
	}

	public void setVersion(int version) {
		this.version = version;
	}

	@Override
	public String toString() {
		return "FieldSystem [id=" + id + ", fieldId=" + fieldId + ", code="
				+ code + ", name=" + name + ", remark=" + remark
				+ ", directoryId=" + directoryId + ", isEnable=" + isEnable
				+ ", creator=" + creator + ", createdDate=" + createdDate
				+ ", modifier=" + modifier + ", lastUpdatedDate="
				+ lastUpdatedDate + ", version=" + version + "]";
	}
	
	
	public static FieldSystemVo getInstance(FieldSystem target){
		FieldSystemVo fieldSystemVo = new FieldSystemVo();
		fieldSystemVo.setId(target.getId());
		fieldSystemVo.setName(target.getName());
		fieldSystemVo.setCode(target.getCode());
		fieldSystemVo.setFieldId(target.getFieldId());
		fieldSystemVo.setVersion(target.getVersion());
		fieldSystemVo.setCreatedDate(target.getCreateTime());
		fieldSystemVo.setCreator(target.getCreator());
		fieldSystemVo.setModifier(target.getModifier());
		/*if(StringUtils.equals(target.getIsEnable(), EnableType.ENABLE.ValueCode)){
			fieldSystemVo.setEnable(true);
		}else{
			fieldSystemVo.setEnable(false);
		}*/
		fieldSystemVo.setEnable(true);
		fieldSystemVo.setLastUpdatedDate(target.getModifyTime());
		return fieldSystemVo;
	}

}
